#ifndef QQTVIRTUALDATAMANAGER_H
#define QQTVIRTUALDATAMANAGER_H

#include <QObject>

#include <qqtdictionary.h>
#include <qqtudpclient.h>
#include <qqtdataprotocol.h>

#include <qqtframe.h>

#include <qqthighgrade_global.h>
/**
 * @brief The QQtVirtualDataManager class
 * LibQQt提供的虚拟接口的网络数据管理者
 * CLIENT
 */
class QQTHIGHGRADESHARED_EXPORT QQtVirtualDataManager : public QObject
{
    Q_OBJECT

public:
    explicit QQtVirtualDataManager ( QObject* parent = 0 );
    virtual ~QQtVirtualDataManager();

    //!1 子类一般会用来设置handler和使用handler。
    void setClientHandler ( QQtUdpClient* handler );
    QQtUdpClient* handler();

    //设置远端服务器IP、端口
    void setServerAddress ( QHostAddress address, int port = 4419 );
    void setServerPort ( int port = 4419 );

    //客户端要接收数据必须bind端口
    void setListeningAddress ( QHostAddress address, int port = 4420 );
    void setListeningPort ( int port = 4420 );

    //!2
    void setProtocolHandler ( QQtDataProtocol* protocol );
    QQtDataProtocol* protocol();

    void sendMessage ( const QQtDataSerialization& data );

signals:
    void readyRead ( const QQtDataSerialization& data );

protected:

protected slots:

protected:

private:
    QQtUdpClient* c0;
    QQtDataProtocol* p0;
};

#endif // QQTVIRTUALDATAMANAGER_H
